package cn.echo.modules.sys.service;

import cn.echo.modules.sys.dao.GradeMapper;
import cn.echo.modules.sys.entity.Grade;
import cn.echo.modules.sys.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * Created by Somet on 2017/4/12.
 * controller中的类调用其中的方法
 */
@Service
public class GradeService {
    @Autowired
    GradeMapper gradeMapper;
    /**
     * 测试查询功能，有id的话查出此id对应的信息，无id查询表中所有用户信息,正常
     */
    public List<Grade> showResult(Grade grade){
        List<Grade> gradeList = null;
        try {
            gradeList = gradeMapper.showResult(grade);
        } catch (Exception e) {
            System.out.println("没有此用户");
            e.printStackTrace();
        }
        return gradeList;
    }
    public boolean updateById(Grade grade){
        gradeMapper.updateById(grade);
        return true;
    }
    public boolean deleteById(Grade grade){
        gradeMapper.deleteById(grade);
        return true;
    }
    public boolean insert(Grade grade){
        gradeMapper.insert(grade);
        return true;
    }
    public List<Grade> selectById(Grade grade) {
        List<Grade> gradeList;
        gradeList = gradeMapper.selectById(grade);
        return gradeList;
    }
}




